/*
 * lab9E1.c
 * CSIS 248 Operating System Programming
 */
#include <stdio.h>
#include <stdlib.h>

int* f(){
	int q = 100;
	return &q;
}

int main() {
	int a = 10;
	int* p = &a;
	*p = 78;
	printf("  p is %p and *p is %d\n", p, *p );
	printf("  a is %d\n\n", a );

	p = (int*) malloc( sizeof(int) );
	*p = 79;
	free(p);
	printf("  p is %p and *p is %d\n\n", p, *p );

	p = f();
	*p = 80;
	printf("  After 'p=f()' p is %p and *p is %d\n", p, *p );
}
